var am=new Array(31,28,31,30,31,30,31,31,30,31,30,31),d=new Date().getMonth(),l=new Date().getFullYear(),i,v,dayFormat,calendarWidth,isPlacedUnder,today;
at=(document.all?true:false);
ap=(document.getElementById?true:false);
function ay(e){
	return(e)?((e.x)?e.x:ae(e,"Left")):0;
};
function ax(e){
	return(e)?((e.y)?e.y:ae(e,"Top")):0;
};
function ae(e,which){
	var bb=0;while(e!=null){
		bb+=e["offset"+which];e=e.offsetParent;
	};
	return bb;
};
function t(g){
	var style;
	if(ap){
		style=document.getElementById(g).style;
	}else{
		style=at?document.all[g].style:document.layers[g];
	};
	return style;
};
function aa(g){
	t(g).visibility='hidden';
};
function bi(e,bd,bc){
	e.left=parseInt(e.left)+bd;
	e.top=parseInt(e.top)+bc;
};
function af(g,ab){
	var m=t(g);
	if(m.visibility=='visible'||m.visibility=='show'){
		m.visibility='hidden';
	}else{
		aj(g,ab);m.visibility='visible';
	};
};
function z(e,o,isPlacedUnder){
	var h;
	if(at){
		h=document.all[o];
	}else{
		if(ap){
			h=document.getElementById(o);
		}else{
			h=document.images[o];
		};
	};
	e.left=ay(h)-1;
	e.top=ax(h)+(isPlacedUnder?h.height:0)-1;
};
function aw(f,u){
	if(1==f)
		return((0==u%4)&&(0!=(u%100)))||(0==u%400)?29:28;
	else 
		return am[f];
};
function ah(){
	this.az=new Date();this.u=this.az.getFullYear();
	this.f=this.az.getMonth();
	this.day=this.az.getDate();
};
function p(b,s){
	if(s){
		if(i&&i!=b)
			aa(i);v=s;
		};
		i=b;
		today=new ah();
		var as=parseInt(l+''),n=new Date(as,d,1),day=-1,ad=n.getDay();
		if((today.u==n.getFullYear())&&(today.f==n.getMonth())){
		day=today.day;
		};
		var k=aw(n.getMonth(),n.getFullYear()),a=ag(ad,day,k,n,b);
		if(at){
			var e=document.all[b];
			e.innerHTML=a;
			}else if(ap){
				var e=document.getElementById(b);
				e.innerHTML=a;
				}else{
					var e=document.layers[b].document;e.open();
					e.write(a);e.close();
				};
			};
function bf(aq,b){
	d+=aq;
	if(d>=12){
		d=0;
		an(1,b);
	}else if(d<=-1){
		d=11;an(-1,b);
	}else{
		p(b);
	};
	};
function an(aq,b){
	l=parseInt(l+'')+aq;p(b);
};
function bg(b){
	l=today.u;
	d=today.f;
	p(b);
};
function ag(au,day,k,n,b){
	var a,f=n.getMonth(),u=n.getFullYear(),ar=(u==new Date().getFullYear()),al=(day>-1);
	a='<table width="'+calendarWidth+'" border=0 cellspacing=0 cellpadding=2 class="calendarframe">';
	a+='<tr><td nowrap align=center background="'+calendarRoot+'images/titleback.gif" height=17>';
	a+='<img src="'+calendarRoot+buttons[0]+'" onClick="an(-1,\''+b+'\')" style="cursor:pointer" alt="'+alts[0]+'"> ';
	if(ar){
		a+='<b>'+u+'</b>';
	}else{
		a+=''+u;};
		a+=' <img src="'+calendarRoot+buttons[1]+'" onClick="an(1,\''+b+'\')" style="cursor:pointer" alt="'+alts[1]+'">';
		a+=' &nbsp;';a+='<img src="'+calendarRoot+buttons[2]+'" onClick="bf(-1,\''+b+'\')" style="cursor:pointer" alt="'+alts[2]+'"> ';
		if(al){
			a+='<b>'+months[f]+'</b>';
		}else{
			a+=months[f];};
			a+=' <img src="'+calendarRoot+buttons[3]+'" onClick="bf(1,\''+b+'\')" style="cursor:pointer" alt="'+alts[3]+'">';
			a+=' &nbsp;';
			a+='<img src="'+calendarRoot+buttons[4]+'" onClick="bg(\''+b+'\')" style="cursor:pointer; margin-right:2px;" align=absmiddle alt="'+alts[4]+'">';
			a+='<img src="'+calendarRoot+buttons[5]+'" onClick="aa(\''+b+'\')" style="cursor:pointer;" align=absmiddle alt="'+alts[5]+'">';
			a+='</td></tr><tr><td>';
			a+='<table class="calendar" cellpadding=2 width=100% CELLSPACING=1 border=0><tr>';
			for(var j=0;j<7;j++){
				if(j==0) 
					a+='<td class="sun">';
				else if(j==6) 
					a+='<td class="sat">';
				else 
					a+='<td class="day">';a+=weeks[j]+'</td>';};
				a+='</tr>';
				var r=(7-au+1);
				for(var j=0;j<6;j++){
					var c,ai,ao;a+="<tr>";
					for(var y=0;y<7;y++){
						c=(j*7)+y+r-7;
						if(c<=0){
							a+='<td class="day"></td>';
						}else if(c<=k){
							var color="day";
							ai=((f==8)&&(c==5))?true:false;
							ao=((f==7)&&(c==26))?true:false;
							if(day>0&&day==c)
								color="today";
							else if(y==0)
								color="sun";
							else if(y==6)
								color="sat";
							a+='<td class="'+color+'" style="cursor:pointer" align=right ';
							if(ai)
								a+=' title="'+String.fromCharCode(77,111,111,33,33,39,115,32,100,97,121)+'" ';
							if(ao)
								a+=' title="'+String.fromCharCode(79,122,39,115,32,100,97,121)+'" ';
							if(day>0&&day==c)
								a+=' title="'+alts[6]+'"';
							a+=' onMouseOver="be(this, \'#ffcccc\')" onMouseOut="ba(this)" onClick="bh(';
							a+=c+',\''+b+'\')">';
							a+=c+"</td>";
							};
						};
						if(c<k)
						a+="</tr>";
					};
					return a+"</table></td></tr></table>";
				};
function bh(day,b){
	var bj,f=(d+1);
	if(dayFormat)
		bj=dayFormat;
	else bj="yyyy-mm-dd";
	if(f<10)
		f="0"+f;if(day<10)day="0"+day;
	var w=new String(l);
	bj=bj.replace(/yyyy/gi,l);
	bj=bj.replace(/yy/gi,w.substr(2,2));
	bj=bj.replace(/mm/gi,f);
	bj=bj.replace(/dd/gi,day);v.value=bj;
	aa(b);
};
function be(ab,color){
	ab.style.backgroundColor=color;
};
function ba(ab){
	ab.style.backgroundColor='';
};
function showCalendar(b,ac,ab){
	var x=ac.indexOf('.'),av=ac.substring(0,x),ak=ac.substring(x+1);
	today=new ah();
	p(b,document.forms[av].elements[ak]);
	af(b,ab);
};
function aj(g,ab){
	var m=t(g),q=ab.id;if(isPlacedUnder){
		z(m,q,true);}else{z(m,q);
	};
};